package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.DieDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity Die and its DTO DieDTO.
 */
@Mapper(componentModel = "spring", uses = {ProductMapper.class, })
public interface DieMapper extends EntityMapper <DieDTO, Die> {

    @Mapping(source = "product.id", target = "productId")
    DieDTO toDto(Die die); 

    @Mapping(source = "productId", target = "product")
    Die toEntity(DieDTO dieDTO); 
    default Die fromId(Long id) {
        if (id == null) {
            return null;
        }
        Die die = new Die();
        die.setId(id);
        return die;
    }
}
